/*
 * qiangungun.com Inc.
 * Copyright (c) 2014 All Rights Reserved.
 */package com.qiangungun.report.dal.ibatis;import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;import com.qiangungun.report.dal.daointerface.RptcfgCatalogDAO;// auto generated importsimport java.util.List;import org.springframework.dao.DataAccessException;import com.qiangungun.report.dal.dataobject.RptcfgCatalogDO;/** * An ibatis based implementation of dao interface <tt>com.qiangungun.report.dal.daointerface.RptcfgCatalogDAO</tt>. * * This file is generated by <tt>financenet-dalgen</tt>, a DAL (Data Access Layer)
 * code generation utility specially developed for <tt>iwallet</tt> project.
 * 
 * PLEASE DO NOT MODIFY THIS FILE MANUALLY, or else your modification may
 * be OVERWRITTEN by someone else. To modify the file, you should go to 
 * directory <tt>(project-home)/biz/dal/src/conf/dalgen</tt>, and 
 * find the corresponding configuration file (<tt>tables/rptcfg_catalog.xml</tt>). 
 * Modify the configuration file according to your needs, then run <tt>financenet-dalgen</tt> 
 * to generate this file.
 *
 */@SuppressWarnings({"unchecked","deprecation"})public class IbatisRptcfgCatalogDAO extends SqlMapClientDaoSupport implements RptcfgCatalogDAO {	/**
	 *  Query DB table <tt>rptcfg_catalog</tt> for records.
	 *
	 *  <p>
	 *  The sql statement for this operation is <br>
	 *  <tt>select ID, CATALOG_CODE, CATALOG_NAME, PARENT_ID from rptcfg_catalog</tt>
	 *
	 *	@return List<RptcfgCatalogDO>
	 *	@throws DataAccessException
	 */	 
    public List<RptcfgCatalogDO> loadAll() throws DataAccessException {

        return getSqlMapClientTemplate().queryForList("MS-RPTCFG-CATALOG-LOAD-ALL", null);

    }		/**
	 *  Query DB table <tt>rptcfg_catalog</tt> for records.
	 *
	 *  <p>
	 *  The sql statement for this operation is <br>
	 *  <tt>select ID, CATALOG_CODE, CATALOG_NAME, PARENT_ID from rptcfg_catalog where (CATALOG_CODE = ?)</tt>
	 *
	 *	@param catalogCode
	 *	@return RptcfgCatalogDO
	 *	@throws DataAccessException
	 */	 
    public RptcfgCatalogDO queryByCataLogCode(String catalogCode) throws DataAccessException {

        return (RptcfgCatalogDO) getSqlMapClientTemplate().queryForObject("MS-RPTCFG-CATALOG-QUERY-BY-CATA-LOG-CODE", catalogCode);

    }		/**
	 *  Insert one <tt>RptcfgCatalogDO</tt> object to DB table <tt>rptcfg_catalog</tt>, return primary key
	 *
	 *  <p>
	 *  The sql statement for this operation is <br>
	 *  <tt>insert into rptcfg_catalog(ID,CATALOG_CODE,CATALOG_NAME,PARENT_ID) values (?, ?, ?, ?)</tt>
	 *
	 *	@param rptcfgCatalog
	 *	@return Long
	 *	@throws DataAccessException
	 */	 
    public Long insert(RptcfgCatalogDO rptcfgCatalog) throws DataAccessException {
    	if (rptcfgCatalog == null) {
    		throw new IllegalArgumentException("Can't insert a null data object into db.");
    	}
    	
        getSqlMapClientTemplate().insert("MS-RPTCFG-CATALOG-INSERT", rptcfgCatalog);

        return rptcfgCatalog.getId();
    }		/**
	 *  Delete records from DB table <tt>rptcfg_catalog</tt>.
	 *
	 *  <p>
	 *  The sql statement for this operation is <br>
	 *  <tt>delete from rptcfg_catalog where (ID = ?)</tt>
	 *
	 *	@param rptcfgCatalog
	 *	@return int
	 *	@throws DataAccessException
	 */	 
    public int delete(RptcfgCatalogDO rptcfgCatalog) throws DataAccessException {
    	if (rptcfgCatalog == null) {
    		throw new IllegalArgumentException("Can't delete by a null data object.");
    	}


        return getSqlMapClientTemplate().delete("MS-RPTCFG-CATALOG-DELETE", rptcfgCatalog);
    }	/**
	 *  Update DB table <tt>rptcfg_catalog</tt>.
	 *
	 *  <p>
	 *  The sql statement for this operation is <br>
	 *  <tt>update rptcfg_catalog set CATALOG_CODE=?, CATALOG_NAME=?, PARENT_ID=? where (ID = ?)</tt>
	 *
	 *	@param rptcfgCatalog
	 *	@return int
	 *	@throws DataAccessException
	 */	 
    public int update(RptcfgCatalogDO rptcfgCatalog) throws DataAccessException {
    	if (rptcfgCatalog == null) {
    		throw new IllegalArgumentException("Can't update by a null data object.");
    	}


        return getSqlMapClientTemplate().update("MS-RPTCFG-CATALOG-UPDATE", rptcfgCatalog);
    }	}	